#include<stdio.h>
void insert(int a[], int n, int num)
{
	int i;
	for(i = n-1;i >= 0;i++)
	{
		if(num < a[i]) {
			a[i+1] = a[i];
		}
		else
		break;
	}
	a[i+1] = num;
}
void PrintArr(int a[],int n)
{
	for(int i = 0;i<n;i++)
	{
		printf("%d ",a[i]);
	}
	printf("\n");
}
int main()
{
	int arr[] = {0};
	int n,num;
	scanf("%d",&n);
	int i = 0;
	for(i = 0;i<n;i++)
	{
		scanf("%d",&arr[i]);
	}
	scanf("%d",&num);
	insert(arr,n,num);
	PrintArr(arr,n + 1);
	return 0;
}
